-
Notifications
You must be signed in to change notification settings - Fork 5
Fix #50 - Breaking: refactory of all main/worker hooks #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We need defensive logic for plugin hooks. If/When plugin hooks fault:
|
@tedpatrick thanks for chiming in ... some extra thoughts of mine:
arguably they probably should ... I can imagine plugins depending on other plugins or plugins that grant some behavior (PyScript error to name the fist one we have) ... should the rest of the App work knowing that essential plugin is broken? I am not entirely sure here ... but a good error on what broke seems fair, although hooks don't carry the plugin name, so that's eventually a PyScript feature to implement, still a valid one. |
a8eb83b
to
5c9ff62
Compare
OK, all details and rebases are just fine now and all better errors will be moved into PyScript as it's PyScript that invokes hooks knowing the exact name and callback, see https://github.com/pyscript/pyscript/blob/main/pyscript.core/src/core.js#L49-L53 |
91a975f
to
3a94107
Compare
3a94107
to
8ebbdf2
Compare
b6e9143
to
c7f87d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll put together a WiP PR over in https://github.com/pyscript/docs to document these hooks. We can refine a bunch of stuff about how we want to document plugins there too. |
c7f87d8
to
acc4d35
Compare
@ntoll I've just updated the docs too to explain hooks the best I could. |
acc4d35
to
c108b08
Compare
@WebReflection great stuff and thank you! |
11bd845
to
d7774e3
Compare
d7774e3
to
c87f490
Compare
This MR implements changes discussed in #50 and by doing so, it breaks everything that to date used hooks.
Breaking Change
The
option
object now accepts ahooks
field with the following properties:onReady
onWorker
- triggered on main, it's the currentonWorkerReady
without the ready part as that's misleadingonBeforeRun
onBeforeRunAsync
onAfterRun
onAfterRunAsync
codeBeforeRun
- exact same as within workerscodeBeforeRunAsync
- exact same as within workerscodeAfterRun
- exact same as within workerscodeAfterRunAsync
- exact same as within workersonReady
- as serializable standalone callbackonBeforeRun
- as serializable standalone callbackonBeforeRunAsync
- as serializable standalone callbackonAfterRun
- as serializable standalone callbackonAfterRunAsync
- as serializable standalone callbackcodeBeforeRun
edit NOTE: these are all strings, not callbackscodeBeforeRunAsync
codeAfterRun
codeAfterRunAsync
All hooks aer already tested via previous (and modified) integration tests.